#! /bin/sh

name=limine
from_source=limine
revision=1
hostdeps="gcc pkg-config"
imagedeps="nasm build-essential mtools"

configure() {
    if [ "$ARCHITECTURE" = "x86_64" ]; then
        X86_FLAGS="--enable-bios \
                   --enable-bios-cd \
                   --enable-bios-pxe \
                   --enable-uefi-ia32 \
        "
    fi

        CFLAGS="$HOST_CFLAGS" \
        CXXFLAGS="$HOST_CXXFLAGS" \
        LDFLAGS="$HOST_LDFLAGS -static" \
    "${source_dir}"/configure \
        --prefix="${prefix}" \
        TOOLCHAIN_FOR_TARGET=${OS_TRIPLET} \
        $X86_FLAGS \
        --enable-uefi-$ARCHITECTURE \
        --enable-uefi-cd
}

build() {
    make -j${parallelism}
}

package() {
    DESTDIR="${dest_dir}" make install

        strip_command=strip \
    post_package_strip
}
